package gameObject.resources3D
{
	import away3d.animators.SkeletonAnimator;
	import away3d.bounds.NullBounds;
	import away3d.containers.ObjectContainer3D;
	
	import flash.events.Event;
	
	public class WeaponConnector extends ObjectContainer3D
	{
		public static const TYPE_MAIN:int = 1;
		public static const TYPE_SECONDARY:int = 2;
		
		/////////////////////////////////////////////////
		private var _type:int;
		private var _LOD:String;
		
		private var _weapon:WeaponResource;
		
		/////////////////////////////////////////////////
		public function get type():int
		{
			return _type;
		}
		
		public function get weapon():WeaponResource
		{
			return _weapon;
		}
		
		public function WeaponConnector(type:int,lod:String)
		{
			super();
			_type = type;
			_LOD = lod;
		}

		public function install(Weapon:WeaponResource):void
		{
			_weapon = Weapon;
			
			addChild(Weapon);
			Weapon.load();
		}
		
		public function remove():void
		{
			if(_weapon)
			{
				if(_weapon.mesh && _weapon.mesh.type==GameMesh.TYPE_SKINNED)
				{
					var animator:SkeletonAnimator = _weapon.mesh.animator as SkeletonAnimator;
					animator.stop();
				}
				removeChild(_weapon);
				
				_weapon = null;
			}
		}
		
		
	}
}